package com.hot12345.service;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import sun.util.logging.resources.logging;

import com.hot12345.dao.ItemDaoImpl;
import com.hot12345.entity.Item;

public class ItemServiceImpl {
	
	private final static Log log = LogFactory.getLog(ItemServiceImpl.class);

	private final static ItemServiceImpl instance = new ItemServiceImpl();
	
	private ItemServiceImpl(){}
	
	public static ItemServiceImpl getInsantce(){
		return instance;
	}
	
	/**
	 * 根据pathKey获取item
	 *	
	 * @param pathKey
	 * @return
	 * @throws Exception
	 * @author wuzongbao
	 * @date 2013-3-11 下午07:10:58
	 * @version V1.0
	 */
	public Item getItemByPathKey(String pathKey) throws Exception{
		
		if(pathKey==null || "".equals(pathKey.trim())){
			log.error("参数为空,params="+pathKey);
			return null;
		}
		Map<String,Object> params = new HashMap<String, Object>();
		params.put("pathKey", pathKey);
		params.put("state", 1);
		ItemDaoImpl itemDao = ItemDaoImpl.getInstance();
		return itemDao.findUniqueByParams(params);
	}
}
